# -*- coding:utf-8 -*-
from django.shortcuts import render, HttpResponse
import json
from  savejson.save_baseinfo import save_base_info
import datetime
from data import models as data_models
# Create your views here.

def index(request):
    return  HttpResponse('index')

def receive_data(request,*args):

    """
    :param request:
    :param args: URL参数:
                        baseInfo:接收基础硬件信息
                        tomcatInfo:接收tomcat运行信息
    :return:
    """
    if request.method == 'POST':
        data = json.loads(request.POST.get('data'))
        main_ip = data['main_ip']
        # 上传/修改基础硬件信息
        if args[0] == 'baseInfo':
            save_base_info(data,main_ip)
            return HttpResponse('ok')